import request from '@/utils/request'

// 加入购物车
export const reqAddToCard = (skuId, skuNum) => {
  return request({
    method: 'post',
    url: `/cart/addToCart/${skuId}/${skuNum}`,
  })
}

// 获取购物车列表
export const reqGetAddCardList = () => {
  return request({
    method: 'get',
    url: `/cart/cartList`,
  })
}

//更新商品数量
export const reqUpdateCart = (skuId, skuNum) => {
  return request({
    method: 'post',
    url: `/cart/addToCart/${skuId}/${skuNum}`,
  })
}

// 切换商品选中状态
export const reqCardIsChecked = (skuId, isChecked) => {
  return request({
    method: 'get',
    url: `/cart/checkCart/${skuId}/${isChecked}`,
  })
}

//删除购物车商品
export const reqDelCartGood = (skuId) => {
  return request({
    method: 'delete',
    url: `cart/deleteCart/${skuId}`,
  })
}
